const default_config = require('./default'),
	develop = require('./develop'),
	trial = require('./trial'),
	release = require('./release');

let wxEnv = null
try {
	wxEnv = wx.getAccountInfoSync().miniProgram.envVersion || __wxConfig.envVersion
} catch (e) {}

// process.env.NODE_ENV
const env = wxEnv || process.env.NODE_ENV || 'release'

console.info(`当前环境：${env}`)

const evnConfig = (function() {
	let currentConfig = {}
	switch (env) {
		case 'develop':
			currentConfig = develop
			break;
		case 'development':
			currentConfig = develop
			break;
		case 'trial':
			currentConfig = trial
			break;
		case 'release':
			currentConfig = release
			break;
		default:
			currentConfig = release
			break;
	}
	return {
		...default_config,
		...currentConfig,
		...{
			environment: env
		}
	}
}())

module.exports = evnConfig
